package com.mayblackcat.amoy.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName : RedissonConfig
 * @Description : 分布式框架
 * @Author : MayBlackCat
 * @Date: 2021-08-24 16:17
 */
@Configuration
public class RedissonConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient getRedissonClient(){
        Config config=new Config();
        //注意：如果是安全模式需要写为：rediss://127.0.0.1:6379
        config.useSingleServer().setAddress("redis://127.0.0.1:6379");
        return Redisson.create(config);
    }
}
